
/*
    Software License

    Copyright (C) 2021-05-24  Xoronos

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, version 3.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <https://www.gnu.org/licenses/>.
*/

/*
    Liabilities

    The software is provided "AS IS" without any warranty of any kind, either expressed,
    implied, or statutory, including, but not limited to, any warranty that the software
    will conform to specifications, any implied warranties of merchantability, fitness
    for a particular purpose, and freedom from infringement, and any warranty that the
    documentation will conform to the software, or any warranty that the software will
    be error free.

    In no event shall Xoronos be liable for any damages, including, but not limited to,
    direct, indirect, special or consequential damages, arising out of, resulting from,
    or in any way connected with this software, whether or not based upon warranty,
    contract, tort, or otherwise, whether or not injury was sustained by persons or
    property or otherwise, and whether or not loss was sustained from, or arose out of
    the results of, or use of, the software or services provided hereunder.

    To request the provided software under a different license you can contact us at
    support@xoronos.com
*/

#include "examples_main.h"

int main_examples( int argc, char *argv[]
 )
{

    xrn_set_default_log(  );
    int example_num;
    char *p;

    if ( argc == 2 ) {
        example_num = ( int ) strtol( argv[1], &p, 10 );
    } else {
        example_num = -1;
    }

    return run_example( example_num );
}

int run_example( int num
 )
{

    if ( num == -1 ) {
        printf( "implemented C examples:\n" );
        printf( "0)  generate_xrn_matrix_one_third()\n" );
        printf( "1)  generate_xrn_matrix_all_rnd()\n" );
        printf( "2)  generate_keys_with_wrapper_functions()\n" );
        printf( "3)  check_xrn_matrix()\n" );
        printf( "4)  split_join_encryption_wrapper()\n" );
        printf( "5)  split_join_encryption_bytes_wrapper()\n" );
        printf( "6)  encrypt_symmetric_wrapper()\n" );
        printf( "7)  encrypt_symmetric_bytes_wrapper()\n" );
        printf( "8)  encrypt_encrypt_asymmetric_wrapper()\n" );
        printf( "9)  encrypt_asymmetric_bytes_wrapper()\n" );
        printf( "10) hash_bytes_wrapper()\n" );
        printf( "11) hash_file_wrapper()\n" );
        printf( "12) symmetric_signature_file_wrapper()\n" );
        printf( "13) symmetric_signature_bytes_wrapper()\n" );
        printf( "14) asymmetric_signature_file_wrapper()\n" );
        printf( "15) asymmetric_signature_bytes_wrapper()\n" );
        printf( "16) pseudo_random_number_generator_wrapper()\n" );
        printf( "17) ring_signature_file_wrapper()\n" );
        printf( "18) ring_signature_bytes_wrapper()\n" );
        printf( "19) monomial_key_exchange()\n" );
        printf( "20) certificate_symmetric()\n" );
        printf( "21) certificate_asymmetric()\n" );
        printf( "22) zero_knowledge_proof_binomial_key()\n" );
        printf( "23) zero_knowledge_proof_signature()\n" );
        printf( "24) zero_knowledge_proof_signature_bytes()\n" );
        printf( "25) zero_knowledge_proof_certificate()\n" );
        printf( "26) permute_xrn_matrix_compressed_rnd()\n" );
        printf( "27) permute_xrn_matrix_compressed_deterministic()\n" );
        printf( "28) permute_xrn_matrix_compressed_key()\n" );
        printf( "29) encoding_decoding_file_wrapper()\n" );
        printf( "30) encoding_decoding_bytes_wrapper()\n" );
        printf( "31) polyvalent_key_exchange()\n" );
        printf( "32) checksum_dump_file_wrapper()\n" );
        printf( "33) checksum_dump_bytes_wrapper()\n" );
        printf( "34) create_blocks_from_file()\n" );
        printf( "35) create_blocks_from_bytes()\n" );
        printf( "36) steganography_block_file()\n" );
        printf( "37) steganography_block_bytes()\n" );
        printf( "38) steganography_raw_file()\n" );
        printf( "39) steganography_raw_bytes()\n" );
    }

    if ( num == 0 ) {
        printf( "\nrunning generate_xrn_matrix_one_third()\n\n" );
        return generate_xrn_matrix_one_third(  );

    } else if ( num == 1 ) {

        printf( "\nrunning generate_xrn_matrix_all_rnd()\n\n" );
        return generate_xrn_matrix_all_rnd(  );

    } else if ( num == 2 ) {

        printf( "\nrunning generate_keys_with_wrapper_functions()\n\n" );
        return generate_keys_with_wrapper_functions(  );

    } else if ( num == 3 ) {

        printf( "\nrunning check_xrn_matrix()\n\n" );
        return check_xrn_matrix(  );

    } else if ( num == 4 ) {

        printf( "\nrunning split_join_encryption_wrapper()\n\n" );
        return split_join_encryption_wrapper(  );

    } else if ( num == 5 ) {

        printf( "\nrunning split_join_encryption_bytes_wrapper()\n\n" );
        return split_join_encryption_bytes_wrapper(  );

    } else if ( num == 6 ) {

        printf( "\nrunning encrypt_symmetric_wrapper()\n\n" );
        return encrypt_symmetric_wrapper(  );

    } else if ( num == 7 ) {

        printf( "\nrunning encrypt_symmetric_bytes_wrapper()\n\n" );
        return encrypt_symmetric_bytes_wrapper(  );

    } else if ( num == 8 ) {

        printf( "\nrunning encrypt_asymmetric_wrapper()\n\n" );
        return encrypt_asymmetric_wrapper(  );

    } else if ( num == 9 ) {

        printf( "\nrunning encrypt_asymmetric_bytes_wrapper()\n\n" );
        return encrypt_asymmetric_bytes_wrapper(  );

    } else if ( num == 10 ) {

        printf( "\nrunning hash_bytes_wrapper()\n\n" );
        return hash_bytes_wrapper(  );

    } else if ( num == 11 ) {

        printf( "\nrunning hash_file_wrapper()\n\n" );
        return hash_file_wrapper(  );

    } else if ( num == 12 ) {

        printf( "\nrunning symmetric_signature_file_wrapper()\n\n" );
        return symmetric_signature_file_wrapper(  );

    } else if ( num == 13 ) {

        printf( "\nrunning symmetric_signature_bytes_wrapper()\n\n" );
        return symmetric_signature_bytes_wrapper(  );

    } else if ( num == 14 ) {

        printf( "\nrunning asymmetric_signature_file_wrapper()\n\n" );
        return asymmetric_signature_file_wrapper(  );

    } else if ( num == 15 ) {

        printf( "\nrunning asymmetric_signature_bytes_wrapper()\n\n" );
        return asymmetric_signature_bytes_wrapper(  );

    } else if ( num == 16 ) {

        printf( "\nrunning pseudo_random_number_generator_wrapper()\n\n" );
        return pseudo_random_number_generator_wrapper(  );

    } else if ( num == 17 ) {

        printf( "\nrunning ring_signature_file_wrapper()\n\n" );
        return ring_signature_file_wrapper(  );

    } else if ( num == 18 ) {

        printf( "\nrunning ring_signature_bytes_wrapper()\n\n" );
        return ring_signature_bytes_wrapper(  );

    } else if ( num == 19 ) {

        printf( "\nrunning monomial_key_exchange()\n\n" );
        return monomial_key_exchange(  );

    } else if ( num == 20 ) {

        printf( "\nrunning certificate_symmetric()\n\n" );
        return certificate_symmetric(  );

    } else if ( num == 21 ) {

        printf( "\nrunning certificate_asymmetric()\n\n" );
        return certificate_asymmetric(  );

    } else if ( num == 22 ) {

        printf( "\nrunning zero_knowledge_proof_binomial_key()\n\n" );
        return zero_knowledge_proof_binomial_key(  );

    } else if ( num == 23 ) {

        printf( "\nrunning zero_knowledge_proof_signature()\n\n" );
        return zero_knowledge_proof_signature(  );

    } else if ( num == 24 ) {

        printf( "\nrunning zero_knowledge_proof_signature_bytes()\n\n" );
        return zero_knowledge_proof_signature_bytes(  );

    } else if ( num == 25 ) {

        printf( "\nrunning zero_knowledge_proof_certificate()\n\n" );
        return zero_knowledge_proof_certificate(  );

    } else if ( num == 26 ) {

        printf( "\nrunning permute_xrn_matrix_compressed_rnd()\n\n" );
        return permute_xrn_matrix_compressed_rnd(  );

    } else if ( num == 27 ) {

        printf( "\nrunning permute_xrn_matrix_compressed_deterministic()\n\n" );
        return permute_xrn_matrix_compressed_deterministic(  );

    } else if ( num == 28 ) {

        printf( "\nrunning permute_xrn_matrix_compressed_key()\n\n" );
        return permute_xrn_matrix_compressed_key(  );

    } else if ( num == 29 ) {

        printf( "\nrunning encoding_decoding_file_wrapper()\n\n" );
        return encoding_decoding_file_wrapper(  );

    } else if ( num == 30 ) {

        printf( "\nrunning encoding_decoding_file_wrapper()\n\n" );
        return encoding_decoding_file_wrapper(  );

    } else if ( num == 31 ) {

        printf( "\nrunning polyvalent_key_exchange()\n\n" );
        return polyvalent_key_exchange(  );

    } else if ( num == 32 ) {

        printf( "\nrunning checksum_dump_file_wrapper()\n\n" );
        return checksum_dump_file_wrapper(  );

    } else if ( num == 33 ) {

        printf( "\nrunning checksum_dump_bytes_wrapper()\n\n" );
        return checksum_dump_bytes_wrapper(  );

    } else if ( num == 34 ) {

        printf( "\nrunning create_blocks_from_file()\n\n" );
        return create_blocks_from_file(  );

    } else if ( num == 35 ) {

        printf( "\nrunning create_blocks_from_bytes()\n\n" );
        return create_blocks_from_bytes(  );

    } else if ( num == 36 ) {

        printf( "\nrunning steganography_block_file()\n\n" );
        return steganography_block_file(  );

    } else if ( num == 37 ) {

        printf( "\nrunning steganography_block_bytes()\n\n" );
        return steganography_block_bytes(  );

    } else if ( num == 38 ) {

        printf( "\nrunning steganography_raw_file()\n\n" );
        return steganography_raw_file(  );

    } else if ( num == 39 ) {

        printf( "\nrunning steganography_raw_bytes()\n\n" );
        return steganography_raw_bytes(  );

    } else {

        return -1;

    }

    return 0;

}

